package com.aiyige.page.discovery.adapter;

import android.view.View;

import com.aiyige.R;
import com.aiyige.page.discovery.model.ActivityData;
import com.aiyige.utils.GlideUtil;
import com.aiyige.utils.widget.RoundCornerImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.LinkedList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ActivityDataAdapter extends BaseQuickAdapter<ActivityData, ActivityDataAdapter.ViewHolder> {


    public ActivityDataAdapter() {
        super(R.layout.activity_data_item, new LinkedList<ActivityData>());
    }

    @Override
    protected void convert(ViewHolder helper, ActivityData item) {
        helper.bindData(item);
    }


    public class ViewHolder extends BaseViewHolder {
        @BindView(R.id.activityDataIv)
        RoundCornerImageView activityDataIv;
        ActivityData data;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

        public void bindData(ActivityData item) {
            data = item;
            GlideUtil.with(itemView.getContext())
                    .loadCover(data.getCoverUrl())
                    .into(activityDataIv);
        }
    }

}
